﻿#include <iostream>
using namespace std;

template < typename T1 , typename T2>
void* test(T1* a, T2* b)
{
    //new T1返回的是T1类型的指针
    T1* c = new T1;
    *c = *a + *b;
    cout << "a=" << a << endl;
    cout << "b=" << b << endl;
    cout << "c=" << c << endl;

    cout << "*a=" << a << endl;
    cout << "*b=" << b << endl;
    cout << "*c=" << c << endl;
    
    return c;
};


int main()
{
    std::cout << "Hello World!\n";

    int a = 1;
    int b = 2.0;

    cout << "test(&a, &b) ="<<test(&a, &b) << endl;
    cout << "=====================" << endl;
    cout << "(int*)(test(&a, &b)) =" << (int*)(test(&a, &b)) << endl;
    cout << "=====================" << endl;
    cout << "*(int*)(test(&a, &b)) =" << *(int*)(test(&a, &b)) << endl;
    cout << "=====================" << endl;
    return 0;
}

